﻿Imports System.Data.OleDb
Imports System.Data
Partial Class RateContests
    Inherits System.Web.UI.Page

    Protected Sub btnRate_Click(sender As Object, e As System.EventArgs) Handles btnRate.Click
        Dim oleDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("myFirstDatabase").ConnectionString)
        Dim SqlString As String = "Insert into tblRatingContest(Rating,Contestid,SubmittedDate) Values (@f1,@f2,@f3)"
        Dim cmd As OleDbCommand = New OleDbCommand(SqlString, oleDbConn)
        Dim SubmittedDate As DateTime = Now()
        Dim format As String = "ddd MMM yyyy"
        cmd.CommandType = CommandType.Text
        cmd.Parameters.AddWithValue("@f1", RBLRate.SelectedValue)
        cmd.Parameters.AddWithValue("@f2", Request.Params("ID"))
        cmd.Parameters.AddWithValue("@f3", SubmittedDate.ToString(format))
        oleDbConn.Open()
        cmd.ExecuteNonQuery()
        Response.Redirect("RatingConfirmation.aspx")
    End Sub
End Class
